<template>
  <div class="accountexpend">
    <el-form :inline="true">
      <!-- <el-form-item label="开始时间：">
        <el-date-picker
          v-model="value1"
          align="right"
          type="date"
          placeholder="选择日期"
          :picker-options="pickerOptions"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束时间：">
        <el-date-picker
          v-model="value2"
          align="right"
          type="date"
          placeholder="选择日期"
          :picker-options="pickerOptions"
          @change="getInfo_num"
        >
        </el-date-picker>
      </el-form-item> -->
      <el-form-item label="起止时间：">
        <el-date-picker
          v-model="value1"
          type="daterange"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
          @change="query()"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="申请单：">
        <el-select v-model="value" placeholder="请选择" @change="showQa()">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button plain @click="onSubmit">查询</el-button>
        <el-button
          class="el-icon-printer"
          plain
          @click="print"
          v-show="!showBtn"
          >打印</el-button
        >
        <el-button plain v-show="showBtn" @click="downdan">勾选制单</el-button>
        <el-button plain v-show="showBtn" @click="downdanAll"
          >全部制单</el-button
        >
      </el-form-item>
    </el-form>
    <div class="xbox">
      <el-table
        :data="tableData"
        border
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
        :row-style="{ height: '48px' }"
        @selection-change="handleSelectionChange"
        height="100%"
      >
        <el-table-column
          type="selection"
          fixed="left"
          width="55"
        ></el-table-column>
        <el-table-column type="index" label="序号" fixed="left" width="60px">
        </el-table-column>
        <!-- <el-table-column prop="ReviewTime" label="支出时间" width="200">
        <template slot-scope="scope">
          <div>
            {{ formatDate(scope.row.ReviewTime) }}
          </div>
        </template>
      </el-table-column> -->
        <el-table-column prop="ReviewResult" label="业务状态" width="120">
          <template slot-scope="scope">
            <div>
              <span v-if="scope.row.ReviewResult == 0">未提交</span>
              <span v-else-if="scope.row.ReviewResult == 1">待审核</span>
              <span v-else-if="scope.row.ReviewResult == 2">审核退回</span>
              <span v-else-if="scope.row.ReviewResult == 9">审核通过</span>
              <span v-else-if="scope.row.ReviewResult == 3">制单打印</span>
              <span v-else-if="scope.row.ReviewResult == 4">财务到账</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="Socialsecuritytype" label="参保类型" width="120">
          <template slot-scope="scope">
            <div>
              <span v-if="scope.row.Socialsecuritytype == 0">其他</span>
              <span v-else-if="scope.row.Socialsecuritytype == 1">城居保</span>
              <span v-else-if="scope.row.Socialsecuritytype == 2">职保</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="Name" label="姓名" width="90" />
        <el-table-column prop="GenderCode" label="性别" width="60">
          <template slot-scope="scope">
            <div v-if="scope.row.GenderCode == 1">男</div>
            <div v-else>女</div>
          </template>
        </el-table-column>
        <el-table-column prop="IdentityNum" label="身份证号" width="180" />
        <el-table-column prop="Balance" label="账户余额" width="150">
          <template slot-scope="scope">
            {{ number_format(scope.row.Balance,2) }}
          </template>
        </el-table-column>
        <el-table-column prop="OutMoney" label="支出金额" width="150">
          <template slot-scope="scope">
            {{ number_format(scope.row.OutMoney,2) }}
          </template>
        </el-table-column>
        <el-table-column prop="OperName" label="经办人" width="100">
        </el-table-column>
        <el-table-column prop="OperTime" label="经办时间" width="190">
          <template slot-scope="scope">
            <div>
              {{ formatDate(scope.row.OperTime) }}
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="ReviewName" label="审核人" width="100">
        </el-table-column>
        <el-table-column prop="ReviewTime" label="审核时间" width="190">
          <template slot-scope="scope">
            <div>
              {{ formatDate(scope.row.ReviewTime) }}
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="FinanceName" label="到账人" width="100">
        </el-table-column>
        <el-table-column prop="FinanceTime" label="到账时间" width="190">
          <template slot-scope="scope">
            <div>
              {{ formatDate(scope.row.FinanceTime) }}
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 50, 100, 200]"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="this.tableData.length"
    >
    </el-pagination>
    <div class="row" id="printTest" style="visibility: hidden">
      <div id="div1">
        <div class="title" style="text-align: center">
          <h3
            id="PageTitle"
            class="text-center"
            style="border-collapse: collapse; margin-left: 0pt"
          >
            被征地农民参保补贴账户支出到账申请单
          </h3>
        </div>
        <table width="100%">
          <tr>
            <td style="border: none; font-size: 8pt">
              <p>
                <span>申请单号：{{ value }}</span>
                <span style="margin-left: 10px">申请日期:</span
                ><span id="ProjectName">{{ dateToString(new Date()).substr(0, 10) }}</span>
              </p>
            </td>
            <td style="text-align: left; border: none; font-size: 8pt">
              <p><span id="ProjectName"></span></p>
            </td>
            <td colspan="2"></td>
            <td></td>
            <td style="text-align: right; font-size: 8pt">
              <span tdata="pageNO" format="#">第#页</span>/<span
                tdata="pageCount"
                format="#"
                >总##页</span
              >
            </td>
          </tr>
        </table>
      </div>
      <!-- <div id="div2">
        <table style="border: 1px solid" width="100%">
          <tr>
            <td style="text-align: center; width: 16.5%;" colspan="1">
              <p>
                <span>所属乡(镇、园区)</span>
              </p>
            </td>
            <td style="text-align: center; width: 16.5%;" colspan="1">
              <p>
                <span id="township">{{ this.dataInfo.township }}</span>
              </p>
            </td>
            <td style="text-align: center; width: 16.5%;" colspan="1">
              <p>
                <span>所属村</span>
              </p>
            </td>
            <td style="text-align: center; width: 16.5%;" colspan="1">
              <p>
                <span id="Village">{{ this.dataInfo.Village }}</span>
              </p>
            </td>
            <td style="text-align: center; width: 16.5%;" colspan="1">
              <p><span>批准用地日期</span></p>
            </td>
            <td style="text-align: center; width: 16.5%;" colspan="1">
              <p>
                <span id="ApprovedDate">{{ this.ApprovedDate }}</span>
              </p>
            </td>
          </tr>
          <tr>
            <td style="text-align: center" colspan="1">
              <p>
                <span>年度</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="YearNum">{{ this.dataInfo.YearNum }}</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span>批次</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="BatchNum">{{ this.dataInfo.BatchNum }}</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span>批准用地面积</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="ApprovedArea"
                  >{{ number_format(this.dataInfo.ApprovedArea, 2) }}亩</span
                >
              </p>
            </td>
          </tr>
          <tr>
            <td style="text-align: center" colspan="1">
              <p><span>被征地农民户数</span></p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="HouseholdCount"
                  >{{ this.dataInfo.HouseholdCount }}户
                </span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p><span>征缴比例</span></p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="LevyScale">{{
                  (this.dataInfo.LevyScale * 100).toFixed(2) + "%"
                }}</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span>区片价</span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="RegionPrice"
                  >{{ number_format(this.dataInfo.RegionPrice, 2) }}元</span
                >
              </p>
            </td>
          </tr>
          <tr>
            <td style="text-align: center" colspan="1">
              <p><span>被征地农民人数</span></p>
            </td>
            <td style="text-align: center" colspan="1">
              <p>
                <span id="FarmerCount">{{ this.dataInfo.FarmerCount }}人 </span>
              </p>
            </td>
            <td style="text-align: center" colspan="1">
              <p><span>社会保险费</span></p>
            </td>
            <td colspan="3" style="text-align: center">
              <p>
                <span style="text-align: right" id="SecurityAmount"
                  >{{ number_format(this.dataInfo.SecurityAmount, 2) }}元
                </span>
              </p>
            </td>
          </tr>
        </table>
      </div> -->
      <div id="div3">
        <table style="border: 1px solid" width="100%">
          <thead>
            <tr>
              <td colspan="1" style="text-align: center">序号</td>
              <td style="text-align: center" colspan="1">支出日期</td>
              <td style="text-align: center" colspan="3">所属乡镇</td>
              <td style="text-align: center" colspan="2">所属村</td>
              <td style="text-align: center" colspan="2">参保类型</td>
              <td style="text-align: center" colspan="2">姓名</td>
              <td style="text-align: center" colspan="2">性别</td>
              <td style="text-align: center" colspan="3">身份证号</td>
              <td style="text-align: center" colspan="2">联系电话</td>
              <td style="text-align: center; width: 100px" colspan="2">
                开户银行
              </td>
              <td style="text-align: center" colspan="2">银行账号</td>
              <td style="text-align: center" colspan="3">账户余额</td>
              <td style="text-align: center" colspan="3">支出金额</td>
            </tr>
          </thead>
          <tbody id="detail">
            <tr v-for="(item, index) in tableData" :key="index">
              <td colspan="1" style="text-align: center">{{ index + 1 }}</td>
              <td colspan="1" style="text-align: center">
                {{ formatDate(item.ReviewTime).substr(0, 10) }}
              </td>
              <td colspan="3" style="text-align: center">
                {{ item.Township }}
              </td>
              <td colspan="2" style="text-align: center">
                {{ item.Village }}
              </td>
              <td colspan="2" style="text-align: center">
                <!-- <span v-if="item.Socialsecuritytype == 0">其他</span>
                <span v-else-if="item.Socialsecuritytype == 2">职保</span>
                <span v-else-if="item.Socialsecuritytype == 1">城居保</span> -->
                {{
                  item.Socialsecuritytype == 2
                    ? "职保"
                    : item.Socialsecuritytype == 0
                    ? "其他"
                    : "城居保"
                }}
              </td>
              <div></div>
              <td colspan="2" style="text-align: center">
                {{ item.Name }}
              </td>
              <td colspan="2" style="text-align: center">
                {{ item.GenderCode == 2 ? "女" : "男" }}
              </td>

              <td colspan="3" style="text-align: center">
                {{ item.IdentityNum }}
              </td>
              <td colspan="2" style="text-align: center">
                {{ item.PhoneNum }}
              </td>
              <td colspan="2" style="text-align: center">
                {{ item.BankName }}
              </td>
              <td colspan="2" style="text-align: center">
                {{ item.BankAccount }}
              </td>
              <td colspan="3" style="text-align: right">
                {{ number_format(item.Balance, 2) }}
              </td>
              <td colspan="3" style="text-align: right">
                {{ number_format(item.OutMoney, 2) }}
              </td>
            </tr>
          </tbody>
          <tr>
            <td colspan="2">总计金额</td>
            <td
              colspan="26"
              style="text-align: right; text-align: right"
              id="SumMoney"
            >
              {{ number_format(allMoney, 2) }}
            </td>
          </tr>
          <tr>
            <td colspan="2">总计金额（大写）</td>
            <td colspan="26" style="text-align: left" id="CSumMoney">
              {{ this.$moneyBig.required(allMoney) }}
            </td>
          </tr>
          <tr>
            <td colspan="10" style="width: 33%">经办人：</td>
            <td colspan="9" style="width: 33%">审核人：</td>
            <td colspan="9" style="width: 33%">负责人：</td>
          </tr>
        </table>
      </div>
      <div id="div4">
        <table style="border: 0px solid" width="100%">
          <tr>
            <td style="text-align: left; font-size: 8pt">
              制单人：{{ this.user_name }}
            </td>
            <td></td>
            <td style="text-align: left; font-size: 8pt">
              制单时间:{{ dateToString(new Date()) }}
            </td>
            <td></td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>

<script>
import { API_FIN_GET_ACLS } from "../../api/Voucherpreparation";
import {
  API_ZHICHU_ACGVD,
  API_ZHICHU_GVA,
  API_ZHICHU_ZH,
  API_ZHICHU_GVAL,
  API_ZHICHU_GVI,
  API_ZHICHU_GOAG,
  API_ZHICHU_GOBA,
} from "../../api/account";
export default {
  name: "",
  data() {
    return {
      msg: "账户支出制单",
      options: [
        {
          value: "-1",
          label: "未制单",
        },
      ],
      value: "-1",
      tableData: [],
      pagesize: 10, //每页的数据条数
      currentPage: 1,
      user_name: "",
      value1: [],
      value2: "",
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
          {
            text: "昨天",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit("pick", date);
            },
          },
          {
            text: "一周前",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", date);
            },
          },
        ],
      },
      showBtn: true,
      multipleSelection: [],
      allMoney: "",
    };
  },
  methods: {
    // 时间戳格式化
    dateToString(date) {
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? "0" + m : m;
      var d = date.getDate();
      d = d < 10 ? "0" + d : d;
      var h = date.getHours();
      h = h < 10 ? "0" + h : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? "0" + minute : minute;
      var second = date.getSeconds();
      second = second < 10 ? "0" + second : second;
      return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + second;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagesize = val;
    },
    handleCurrentChange(currentPage) {
      this.currentPage = currentPage;
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    formatDate(time) {
      if (time != "") {
        if (time.toString().substr(6, 13) < 0) {
          return "";
        } else {
          return this.timeD(new Date(parseInt(time.toString().substr(6, 13))));
        }
      }
    },
    print() {
      LODOP.PRINT_INIT(" 被征地农民参保补贴账户支出到账申请单（职保）");
      var strStyle =
        "<style> table,td,th {border-width: 1px;border-style: solid;border-collapse: collapse}span{  font-size:8pt ;text-align:left;margin-top:5px;margin-left:15px;}td{font-size:8pt ;padding:5px;}</style>";
      LODOP.ADD_PRINT_HTM(
        26,
        "5%",
        "90%",
        109,
        document.getElementById("div1").innerHTML
      );
      LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
      LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
      LODOP.SET_PRINT_PAGESIZE(2, "210mm", "297mm");
      // LODOP.ADD_PRINT_TABLE(
      //   100,
      //   "5%",
      //   "RightMargin:1cm",
      //   400,
      //   strStyle + document.getElementById("div2").innerHTML
      // );
      LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
      LODOP.ADD_PRINT_TABLE(
        93,
        "5%",
        "RightMargin:1cm",
        "BottomMargin:1cm",
        strStyle + document.getElementById("div3").innerHTML
      );
      LODOP.SET_PRINT_STYLEA(0, "Offset2Top", -100);
      LODOP.ADD_PRINT_HTM(
        "190mm",
        "15mm",
        "200mm",
        "2cm",
        document.getElementById("div4").innerHTML
      );
      LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
      LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 4);
      //LODOP.SET_PRINT_STYLEA(0, "VOrient", 1);
      LODOP.PREVIEW();
    },
    dateToString(date) {
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? "0" + m : m;
      var d = date.getDate();
      d = d < 10 ? "0" + d : d;
      var h = date.getHours();
      h = h < 10 ? "0" + h : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? "0" + minute : minute;
      var second = date.getSeconds();
      second = second < 10 ? "0" + second : second;
      return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + second;
    },
    timeD(date) {
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? "0" + m : m;
      var d = date.getDate();
      d = d < 10 ? "0" + d : d;
      var h = date.getHours();
      h = h < 10 ? "0" + h : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? "0" + minute : minute;
      var second = date.getSeconds();
      second = second < 10 ? "0" + second : second;
      return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + second;
    },
    // 获取所有申请单列表
    query() {
      let timestart = null;
      let timeend = null;
      this.options = [
        {
          value: "-1",
          label: "未制单",
        },
      ];
      console.log(this.value1);
      if (
        this.value1[0] == "" ||
        this.value1[0] == null ||
        this.value1[1] == "" ||
        this.value1[1] == null
      ) {
        this.$message.warning("请选择起止时间！");
      } else {
        var reg = /^((?:19|20)\d\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;
        var regExp = new RegExp(reg);
        // console.log(reg.test(this.value1[0].toString()));
        // console.log(reg.test(this.value1[1].toString()));
        if (regExp.test(this.value1[0]) && regExp.test(this.value1[1])) {
          timestart = this.value1[0];
          timeend = this.value1[1];
        } else {
          timestart =
            this.value1[0].getFullYear() +
            "-" +
            (this.value1[0].getMonth() + 1) +
            "-" +
            this.value1[0].getDate();
          timeend =
            this.value1[1].getFullYear() +
            "-" +
            (this.value1[1].getMonth() + 1) +
            "-" +
            this.value1[1].getDate();
        }
        // console.log(timestart); // 开始时间
        // console.log(timeend); // 结束时间
        let data = {
          ReviewResult: 99,
          SDT: timestart,
          EDT: timeend,
        };
        API_FIN_GET_ACLS(data)
          .then((res) => {
            console.log(res);
            this.$message.success("查询成功！");
            res.ResList.map((item, index) => {
              this.options.push({
                value: item.ApplyGroupid,
                label: item.ApplyGroupid,
              });
            });
            console.log(this.options);
          })
          .catch((err) => {
            console.log(err);
          });
      }
    },
    nowTim() {
      this.value1["0"] =
        new Date().getFullYear() +
        "-" +
        (new Date().getMonth() + 1 < 10
          ? "0" + (new Date().getMonth() + 1)
          : new Date().getMonth() + 1) +
        "-" +
        (new Date().getDate() < 10
          ? "0" + new Date().getDate()
          : new Date().getDate());
      this.value1["1"] =
        new Date().getFullYear() +
        "-" +
        (new Date().getMonth() + 1 < 10
          ? "0" + (new Date().getMonth() + 1)
          : new Date().getMonth() + 1) +
        "-" +
        (new Date().getDate() < 10
          ? "0" + new Date().getDate()
          : new Date().getDate());
    },
    onSubmit() {
      // this.showQa();
      // console.log(this.value1);
      // console.log(this.value2);
      let timestart = null;
      let timeend = null;
      if (
        this.value1[0] == "" ||
        this.value1[0] == null ||
        this.value1[1] == "" ||
        this.value1[1] == null
      ) {
        this.$message.warning("请选择起止时间！");
      } else {
        var reg = /^((?:19|20)\d\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;
        var regExp = new RegExp(reg);
        // console.log(reg.test(this.value1[0].toString()));
        // console.log(reg.test(this.value1[1].toString()));
        if (regExp.test(this.value1[0]) && regExp.test(this.value1[1])) {
          timestart = this.value1[0];
          timeend = this.value1[1];
        } else {
          timestart =
            this.value1[0].getFullYear() +
            "-" +
            (this.value1[0].getMonth() + 1) +
            "-" +
            this.value1[0].getDate();
          timeend =
            this.value1[1].getFullYear() +
            "-" +
            (this.value1[1].getMonth() + 1) +
            "-" +
            this.value1[1].getDate();
        }
        console.log(timestart); // 开始时间
        console.log(timeend); // 结束时间
      }
      if (this.value == -1) {
        let data = {
          SDT: timestart,
          EDT: timeend,
          ReviewResult: 9,
        };
        API_ZHICHU_ACGVD(data)
          .then((res) => {
            // console.log(res);
            this.tableData = res.ResList;
            this.$message.success("查询成功！");
          })
          .catch((err) => {
            console.log(err);
          });
      } else {
        let data = {
          Applyid: this.value,
        };
        console.log(data);
        API_ZHICHU_GOBA(data)
          .then((res) => {
            console.log(res);
            this.tableData = res.ResList;
            this.$message.success("查询成功！");
            let a = 0;
            res.ResList.map((item, index) => {
              a += Number(item.OutMoney);
            });
            this.allMoney = a;
            console.log(this.allMoney);
          })
          .catch((err) => {
            console.log(err);
          });
      }
    },
    // 月转化为年显示
    yearjs(num) {
      if ((num % 12 != 0) & (num > 12)) {
        return parseInt(num / 12) + "年" + (num % 12) + "月";
      } else if (num < 12) {
        return num + "月";
      } else {
        return parseInt(num / 12);
      }
    },
    showQa() {
      if (this.value == -1) {
        this.showBtn = true;
      } else {
        this.showBtn = false;
      }
    },
    downdan() {
      let data = this.multipleSelection.map((item) => {
        return {
          Id: item.Id,
        };
      });
      console.log(data);
      if (data.length != 0) {
        API_ZHICHU_GVAL(data)
          .then((res) => {
            console.log(res);
            this.$message.success("制单成功！");
            this.query();
            this.onSubmit();
            // this.overChange();
            // this.finge();
            // this.print()
            // this.value1 = res.ResMesssage;
            // this.cardNum = res.ResMesssage;
            // this.showApply = true;
            // this.showBtn = false;
          })
          .catch((err) => {
            console.log(err);
          });
      } else {
        this.$message({
          message: "请选择数据！",
          type: "warning",
        });
      }
    },
    downdanAll() {
      let data = this.tableData.map((item) => {
        return {
          Id: item.Id,
        };
      });
      console.log(data);
      if (data.length != 0) {
        API_ZHICHU_GVAL(data)
          .then((res) => {
            console.log(res);
            this.$message.success("制单成功！");
            this.query();
            this.onSubmit();
            // this.overChange();
            // this.finge();
            // this.value1 = res.ResMesssage;
            // this.cardNum = res.ResMesssage;
            // this.showApply = true;
            // this.showBtn = false;
          })
          .catch((err) => {
            console.log(err);
          });
      } else {
        this.$message({
          message: "未识别有效数据！",
          type: "warning",
        });
      }
    },
    // 金额格式化
    number_format(number, decimals, dec_point, thousands_sep) {
      /*
       * 参数说明：
       * number：要格式化的数字
       * decimals：保留几位小数
       * dec_point：小数点符号
       * thousands_sep：千分位符号
       *
       */
      number = (number + "").replace(/[^0-9+-Ee.]/g, "");
      var n = !isFinite(+number) ? 0 : +number,
        prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
        sep = typeof thousands_sep === "undefined" ? "," : thousands_sep,
        dec = typeof dec_point === "undefined" ? "." : dec_point,
        s = "",
        toFixedFix = function (n, prec) {
          var k = Math.pow(10, prec);
          return "" + parseInt(n * k) / k;
        };
      s = (prec ? toFixedFix(n, prec) : "" + parseInt(n)).split(".");
      var re = /(-?\d+)(\d{3})/;
      while (re.test(s[0])) {
        s[0] = s[0].replace(re, "$1" + sep + "$2");
      }
      if ((s[1] || "").length < prec) {
        s[1] = s[1] || "";
        s[1] += new Array(prec - s[1].length + 1).join("0");
      }
      return s.join(dec);
    },
  },
  created() {
    this.user_name = localStorage.getItem("user");
    this.nowTim();
    this.query();
  },
};
</script>

<style scoped lang="scss">
.accountexpend {
  padding: 30px;
  .el-pagination {
    text-align: right;
    margin-top: 10px;
  }
  .xbox {
    height: calc(100vh - 220px);
  }
  @media only screen {
    #printTest {
      display: none;
    }
  }
}
</style>
